<div id="block-lists" class="block">
  <div class="secondary-navigation">
    <ul>
      <% Category.all.each_with_index do |c, i|  %>
        <li class="<%= 0==i ? 'first' : ''  %> <%=  c.name == params[:keywords] ? 'active' : '' %>  "><a href="/forums?keywords=<%= c.name   %>"><%= c.name %></a></li>
      <% end %>
    </ul>
    <div class="clear">   </div>
  </div>            
  
  <div class="content">
    <h1>文章列表</h1>
    <%=render :partial =>"search" %>
    <table class="table" >
      <tr>
        <th><%= order_by_link({:category => :name} ,:text =>'分类' ) %></th>
        <th><%= order_by_link(:title ,:text =>'标题' ) %></th>
        <th>作者</th>
        <th>回复</th>
      </tr>
      
      <% @articles.each do |article| %>
        <tr>
          <td><%=h article.category.try(:name) %></td>
          <td><%=  link_to(h(article.title) , blog_path(article)  ) %></td>
          <td><%=h article.user.try(:name) %></td>
          <td><%=h article.article_comments.count%></td>
        </tr>
      <% end %>
    </table>
    
    <br />
  </div>
</div>